.class Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;
.super Ljava/lang/Object;
.source "ReginaLauncher.java"

# interfaces
.implements Ljava/lang/Runnable;


# annotations
.annotation system Ldalvik/annotation/EnclosingMethod;
    value = Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->initElementsToDefault()V
.end annotation

.annotation system Ldalvik/annotation/InnerClass;
    accessFlags = 0x0
    name = null
.end annotation


# instance fields
.field final synthetic this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;


# direct methods
.method constructor <init>(Lcom/nemustech/regina/ReginaLauncher$ElementLoader;)V
    .locals 0
    .parameter

    .prologue
    .line 1764
    iput-object p1, p0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    return-void
.end method


# virtual methods
.method public run()V
    .locals 21

    .prologue
    .line 1768
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$800(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ElementLocator;

    move-result-object v4

    invoke-virtual {v4}, Lcom/nemustech/regina/ElementLocator;->getWorkspaceCount()I

    move-result v20

    .line 1769
    .local v20, workspaceCount:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$800(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ElementLocator;

    move-result-object v4

    invoke-virtual {v4}, Lcom/nemustech/regina/ElementLocator;->getCurrentWorkspaceIndex()I

    move-result v18

    .line 1770
    .local v18, curWsIndex:I
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$800(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ElementLocator;

    move-result-object v4

    const/4 v5, 0x1

    sub-int v5, v18, v5

    add-int v5, v5, v20

    rem-int v5, v5, v20

    invoke-virtual {v4, v5}, Lcom/nemustech/regina/ElementLocator;->getWorkspace(I)Lcom/nemustech/regina/RGWorkspace;

    move-result-object v10

    .line 1771
    .local v10, leftWs:Lcom/nemustech/regina/RGWorkspace;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$800(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ElementLocator;

    move-result-object v4

    add-int/lit8 v5, v18, 0x1

    rem-int v5, v5, v20

    invoke-virtual {v4, v5}, Lcom/nemustech/regina/ElementLocator;->getWorkspace(I)Lcom/nemustech/regina/RGWorkspace;

    move-result-object v17

    .line 1773
    .local v17, rightWs:Lcom/nemustech/regina/RGWorkspace;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$700(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ElementMaker;

    move-result-object v4

    new-instance v5, Lcom/nemustech/regina/widgets/ReginaWidgetID;

    const/4 v6, 0x2

    invoke-direct {v5, v6}, Lcom/nemustech/regina/widgets/ReginaWidgetID;-><init>(I)V

    const/4 v6, 0x0

    const/4 v7, -0x1

    const-wide/16 v8, 0x7

    invoke-virtual/range {v4 .. v10}, Lcom/nemustech/regina/ElementMaker;->createReginaWidget(Lcom/nemustech/regina/widgets/ReginaWidgetID;Landroid/graphics/Rect;IJLcom/nemustech/regina/RGWorkspace;)Lcom/nemustech/regina/Element;

    move-result-object v19

    check-cast v19, Lcom/nemustech/regina/ElementReginaWidget;

    .line 1775
    .local v19, wgElement:Lcom/nemustech/regina/ElementReginaWidget;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$800(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ElementLocator;

    move-result-object v4

    move-object v0, v4

    move-object/from16 v1, v19

    move-object v2, v10

    invoke-virtual {v0, v1, v2}, Lcom/nemustech/regina/ElementLocator;->arrange(Lcom/nemustech/regina/Element;Lcom/nemustech/regina/RGWorkspace;)Z

    move-result v4

    const/4 v5, 0x1

    if-ne v4, v5, :cond_0

    .line 1776
    const/4 v4, 0x0

    invoke-virtual/range {v19 .. v19}, Lcom/nemustech/regina/ElementReginaWidget;->getY()F

    move-result v5

    invoke-virtual/range {v19 .. v19}, Lcom/nemustech/regina/ElementReginaWidget;->getZ()F

    move-result v6

    move-object/from16 v0, v19

    move v1, v4

    move v2, v5

    move v3, v6

    invoke-virtual {v0, v1, v2, v3}, Lcom/nemustech/regina/ElementReginaWidget;->locate(FFF)V

    .line 1777
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    move-object v0, v4

    move-object/from16 v1, v19

    invoke-virtual {v0, v1}, Lcom/nemustech/regina/ReginaLauncher;->addElementToDatabase(Lcom/nemustech/regina/Element;)V

    .line 1780
    :cond_0
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$700(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ElementMaker;

    move-result-object v11

    new-instance v12, Lcom/nemustech/regina/widgets/ReginaWidgetID;

    const/4 v4, 0x1

    invoke-direct {v12, v4}, Lcom/nemustech/regina/widgets/ReginaWidgetID;-><init>(I)V

    const/4 v13, 0x0

    const/4 v14, -0x1

    const-wide/16 v15, 0x8

    invoke-virtual/range {v11 .. v17}, Lcom/nemustech/regina/ElementMaker;->createReginaWidget(Lcom/nemustech/regina/widgets/ReginaWidgetID;Landroid/graphics/Rect;IJLcom/nemustech/regina/RGWorkspace;)Lcom/nemustech/regina/Element;

    move-result-object v19

    .end local v19           #wgElement:Lcom/nemustech/regina/ElementReginaWidget;
    check-cast v19, Lcom/nemustech/regina/ElementReginaWidget;

    .line 1782
    .restart local v19       #wgElement:Lcom/nemustech/regina/ElementReginaWidget;
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$800(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ElementLocator;

    move-result-object v4

    move-object v0, v4

    move-object/from16 v1, v19

    move-object/from16 v2, v17

    invoke-virtual {v0, v1, v2}, Lcom/nemustech/regina/ElementLocator;->arrange(Lcom/nemustech/regina/Element;Lcom/nemustech/regina/RGWorkspace;)Z

    move-result v4

    const/4 v5, 0x1

    if-ne v4, v5, :cond_1

    .line 1783
    const/4 v4, 0x0

    invoke-virtual/range {v19 .. v19}, Lcom/nemustech/regina/ElementReginaWidget;->getY()F

    move-result v5

    invoke-virtual/range {v19 .. v19}, Lcom/nemustech/regina/ElementReginaWidget;->getZ()F

    move-result v6

    move-object/from16 v0, v19

    move v1, v4

    move v2, v5

    move v3, v6

    invoke-virtual {v0, v1, v2, v3}, Lcom/nemustech/regina/ElementReginaWidget;->locate(FFF)V

    .line 1784
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    move-object v0, v4

    move-object/from16 v1, v19

    invoke-virtual {v0, v1}, Lcom/nemustech/regina/ReginaLauncher;->addElementToDatabase(Lcom/nemustech/regina/Element;)V

    .line 1787
    :cond_1
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    new-instance v5, Lcom/nemustech/regina/ReginaLauncher$CacheWorkspaceThumbRunnable;

    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v6, v0

    iget-object v6, v6, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    const/4 v7, 0x1

    invoke-direct {v5, v6, v7}, Lcom/nemustech/regina/ReginaLauncher$CacheWorkspaceThumbRunnable;-><init>(Lcom/nemustech/regina/ReginaLauncher;Z)V

    invoke-static {v4, v5}, Lcom/nemustech/regina/ReginaLauncher;->access$902(Lcom/nemustech/regina/ReginaLauncher;Lcom/nemustech/regina/ReginaLauncher$CacheWorkspaceThumbRunnable;)Lcom/nemustech/regina/ReginaLauncher$CacheWorkspaceThumbRunnable;

    .line 1788
    move-object/from16 v0, p0

    iget-object v0, v0, Lcom/nemustech/regina/ReginaLauncher$ElementLoader$1;->this$1:Lcom/nemustech/regina/ReginaLauncher$ElementLoader;

    move-object v4, v0

    iget-object v4, v4, Lcom/nemustech/regina/ReginaLauncher$ElementLoader;->this$0:Lcom/nemustech/regina/ReginaLauncher;

    invoke-static {v4}, Lcom/nemustech/regina/ReginaLauncher;->access$900(Lcom/nemustech/regina/ReginaLauncher;)Lcom/nemustech/regina/ReginaLauncher$CacheWorkspaceThumbRunnable;

    move-result-object v4

    invoke-virtual {v4}, Lcom/nemustech/regina/ReginaLauncher$CacheWorkspaceThumbRunnable;->run()V

    .line 1789
    return-void
.end method
